<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function arr(s) {
      let num = Number('0b' + s)
      let step = 0
      while (num !== 1) {
        if (num % 2 === 0) {
          num /= 2
        } else {
          num += 1
        }
        step++
      }
      return step
    };
    console.log(arr("1101"));
  </script>
</body>

</html>